import { createApp } from 'vue';

import Cookies from 'js-cookie'

import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import locale from "element-plus/es/locale/lang/zh-cn";

import '@/assets/styles/index.scss';

import App from './App.vue'
import router from './router';
import store from './store'

import './permission'

const app = createApp(App)

app.use(router);
app.use(store);

// API
import {
    getApiConfigParams,
    getApiConfig,
    getApi,
    postApiConfig,
    deleteApiConfig,
    deleteApiConfigParams,
    putApiConfig,
    patchApiConfig,
    getApiExcel,
    getApiExcelParams,
    postApiExcel,
} from "@/api/apiConfig";

app.config.globalProperties.getApiConfigParams = getApiConfigParams;
app.config.globalProperties.getApiConfig = getApiConfig;
app.config.globalProperties.getApi = getApi;
app.config.globalProperties.postApiConfig = postApiConfig;
app.config.globalProperties.deleteApiConfig = deleteApiConfig;
app.config.globalProperties.deleteApiConfigParams = deleteApiConfigParams;
app.config.globalProperties.putApiConfig = putApiConfig;
app.config.globalProperties.patchApiConfig = patchApiConfig;
app.config.globalProperties.getApiExcel = getApiExcel;
app.config.globalProperties.getApiExcelParams = getApiExcelParams;
app.config.globalProperties.postApiExcel = postApiExcel;

// 使用element-plus 并且设置全局的大小
app.use(ElementPlus,{
    locale: locale,
    // 支持 large、default、small
    size: Cookies.get('size') || 'default'
})

app.mount('#app')
